package com.gongren.project.mq.sender;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by zhangjinxia on 2017/8/22.
 */
@Component
public class MqSenderImpl implements IMqSender{

    private static Logger logger = LoggerFactory.getLogger(MqSenderImpl.class);

    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void send(String queue, Object o) {
        logger.info(String.format("gongren-mq send to queue:%s o: %s", queue, o));
        rabbitTemplate.convertAndSend(queue, o);
    }
}
